import re
import sys

colors = {"Cyan":"729fcf",
    "Yellow":"edd400",
    "Purple":"75507b",
    "Green":"73d216",
    "Red":"cc0000",
    "Blue":"204a87",
    "Orange":"f57900"}

basefilename = sys.argv[1]
basefh = open(basefilename,"r")
basesvg = basefh.read()

for color,hex in colors.iteritems():
    newfilename = color + ".svg"
    newfh = open(newfilename,"w")
    
    (newsvg,n) = re.subn("fill:#......", "fill:#" + hex, basesvg)

    newfh.write(newsvg)
    newfh.close()
    print "Generating %s done." % color

